//入口文件

const express = require('express')
const path = require('path')
const app = express()

const {
    serverConfig
} = require(path.join(__dirname, 'config'))
//数据库连接模块
const sequelize = require(__dirname, 'db', 'connect.js')
global.sequelize = sequelize
//导入数据模型
// global.Model = require(path.join(__dirname, 'db', 'models', 'models.js'))
// const users = require(path.join(__dirname, 'db', 'models', 'users.js'))
const user = require('./db/models/models')
console.log(user);

//全局保存根路径
global.baseName = __dirname


let routersFileName = path.join(__dirname, 'routes')
const router = require(routersFileName)


app.use(router) //使用路由

app.listen(serverConfig.port, () => {
    console.log(`the server running at ${serverConfig.host}:${serverConfig.port} port!`);
})